Monitor DRBD
|
Configure 2 DRBD servers as cluster. |
|
[1] | Set basic configuration of HeartBeat on (1) section.
|
[2] | Set basic configuration of DRBD on DRBD section.
|
[3] | Configure like below on both Host. (DRBD is already runnning on both server.) |
[root@www1 ~]# /etc/rc.d/init.d/heartbeat stop Stopping High-Availability services: [ OK ] [root@www1 ~]# cd /var/lib/heartbeat/crm [root@www1 crm]# rm -f cib.xml.* [root@www1 crm]# vi cib.xml <cib generated="true" admin_epoch="0" epoch="1" have_quorum="true" ignore_dtd="false" ccm_transition="2" num_peers="2" cib_feature_revision="2.0" dc_uuid="f8719a77-70b4-4e5f-851b-dafa7d65d3a2" num_updates="4" cib-last-written="Sun Jun 15 05:04:30 2008"> <configuration> <crm_config> <cluster_property_set id="cib-bootstrap-options"> <attributes> <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="2.1.3-node: 552305612591183b1628baa5bc6e903e0f1e26a3"/> </attributes> </cluster_property_set> </crm_config> <nodes> <node id="2bbd6408-ec01-4b8c-bb8e-207237af3a99" uname="www1.server-linux.info" type="normal"/> <node id="f8719a77-70b4-4e5f-851b-dafa7d65d3a2" uname="www2.server-linux.info" type="normal"/> </nodes> <resources/> <= remove # add these lines for DRBD
<resources>
<constraints/> <master_slave id="ms-drbd0"> <meta_attributes id="ma-ms-drbd0"> <attributes> <nvpair id="ma-ms-drbd0-1" name="clone_max" value="2"/> <nvpair id="ma-ms-drbd0-2" name="clone_node_max" value="1"/> <nvpair id="ma-ms-drbd0-3" name="master_max" value="1"/> <nvpair id="ma-ms-drbd0-4" name="master_node_max" value="1"/> <nvpair id="ma-ms-drbd0-5" name="notify" value="yes"/> <nvpair id="ma-ms-drbd0-6" name="globally_unique" value="false"/> </attributes> </meta_attributes> <primitive id="drbd0" class="ocf" type="drbd" provider="heartbeat"> <instance_attributes id="ia-drbd0"> <attributes> # specify resource "value=" that is set on DRBD section <nvpair id="ia-drbd0-1" name="drbd_resource" value="r0"/> </attributes> </instance_attributes> </primitive> </master_slave> <primitive id="fs0" class="ocf" type="Filesystem" provider="heartbeat"> <meta_attributes id="ma-fs0"> <attributes/> </meta_attributes> <instance_attributes id="ia-fs0"> <attributes> <nvpair id="ia-fs0-1" name="fstype" value="ext3"/> # specify mount point "value=xxx" <nvpair id="ia-fs0-2" name="directory" value="/mnt/drbd"/> # specify device "value=xxx" that is set on DRBD section <nvpair id="ia-fs0-3" name="device" value="/dev/drbd0"/> </attributes> </instance_attributes> </primitive> </resources> <constraints> <rsc_location id="rsc_location_group_1" rsc="ms-drbd0"> <rule id="prefered_location_group_1" role="Master" score="100"> # specify primary node "value=xxx" that is set on DRBD section <expression id="prefered_location_group_1_expr" attribute="#uname" operation="eq" value="www1.server-linux.info"/> </rule> </rsc_location> <rsc_order id="drbd0_before_fs0" from="fs0" action="start" to="ms-drbd0" to_action="promote"/> <rsc_colocation id="fs0_on_drbd0" to="ms-drbd0" to_role="master" from="fs0" score="infinity"/> </constraints> <= remove </configuration> </cib> [root@www1 crm]# /etc/rc.d/init.d/heartbeat start Starting High-Availability services: [ OK ] |
[4] | Run crm_mon after some time passed, then following result is shown, it's OK. DRBD is controled by HeartBeat and DRBD disk is mounted automatically on primary node like below. |
[root@www1 crm]# crm_mon -i 3 Defaulting to one-shot mode You need to have curses available at compile time to enable console mode ============ Last updated: Wed Jun 18 23:16:41 2008 Current DC: www2.server-linux.info (f8719a77-70b4-4e5f-851b-dafa7d65d3a2) 2 Nodes configured. 2 Resources configured. ============ Node: www1.server-linux.info (2bbd6408-ec01-4b8c-bb8e-207237af3a99): online Node: www2.server-linux.info (f8719a77-70b4-4e5f-851b-dafa7d65d3a2): online Master/Slave Set: ms-drbd0 drbd0:0 (heartbeat::ocf:drbd): Master www1.server-linux.info drbd0:1 (heartbeat::ocf:drbd): Started www2.server-linux.info fs0 (heartbeat::ocf:Filesystem): Started www1.server-linux.info [root@www1 crm]# df -h Filesystem Size Used Available Use% Mounted on /dev/hda1 20G 2.7G 17G 14% / tmpfs 513M 0 513 0% /dev/shm /dev/drbd0 1008M 18M 940M 2% /mnt/drbd
|
[5] | Shutdown HeartBeat on primary server and verify if HeartBeat works or not. |
[root@www1 crm]# /etc/rc.d/init.d/heartbeat stop Starting High-Availability services: [ OK ] |
Run crm_mon on secondary. DRBD disk is mounted automatically like below. HeartBeat works normally. |
[root@www2 crm]# crm_mon -i 3 Defaulting to one-shot mode You need to have curses available at compile time to enable console mode ============ Last updated: Wed Jun 18 23:32:11 2008 Current DC: www2.server-linux.info (f8719a77-70b4-4e5f-851b-dafa7d65d3a2) 2 Nodes configured. 2 Resources configured. ============ Node: www1.server-linux.info (2bbd6408-ec01-4b8c-bb8e-207237af3a99): OFFLINE Node: www2.server-linux.info (f8719a77-70b4-4e5f-851b-dafa7d65d3a2): online Master/Slave Set: ms-drbd0 drbd0:0 (heartbeat::ocf:drbd): Master www2.server-linux.info drbd0:1 (heartbeat::ocf:drbd): Stopped fs0 (heartbeat::ocf:Filesystem): Started www2.server-linux.info [root@www2 crm]# df -h Filesystem Size Used Available Use% Mounted on /dev/hda1 15G 1.6G 13G 12% / tmpfs 513M 0 513 0% /dev/shm /dev/drbd0 1008M 18M 940M 2% /mnt/drbd
|
[6] | Start HeartBeat again on primary server and verify if HeartBeat works or not. |
[root@www1 crm]# /etc/rc.d/init.d/heartbeat start Starting High-Availability services: [ OK ] |
Run crm_mon on secondary. DRBD disk is mounted automatically again like below. HeartBeat works normally. |
[root@www1 crm]# crm_mon -i 3 Defaulting to one-shot mode You need to have curses available at compile time to enable console mode ============ Last updated: Wed Jun 18 23:37:25 2008 Current DC: www2.server-linux.info (f8719a77-70b4-4e5f-851b-dafa7d65d3a2) 2 Nodes configured. 2 Resources configured. ============ Node: www1.server-linux.info (2bbd6408-ec01-4b8c-bb8e-207237af3a99): OFFLINE Node: www2.server-linux.info (f8719a77-70b4-4e5f-851b-dafa7d65d3a2): online Master/Slave Set: ms-drbd0 drbd0:0 (heartbeat::ocf:drbd): Slave www2.server-linux.info drbd0:1 (heartbeat::ocf:drbd): Master www1.server-linux.info fs0 (heartbeat::ocf:Filesystem): Started www1.server-linux.info [root@www1 crm]# df -h Filesystem Size Used Available Use% Mounted on /dev/hda1 20G 2.7G 17G 14% / tmpfs 513M 0 513 0% /dev/shm /dev/drbd0 1008M 18M 940M 2% /mnt/drbd
|